package com.briup.estore.service.impl;

import java.math.BigInteger;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.briup.estore.bean.Category;
import com.briup.estore.mapper.ICategoryMapper;
import com.briup.estore.service.ICategoryService;

@Service
public class CategotyServiceImpl implements ICategoryService {

	@Autowired
	private ICategoryMapper categoryMapper;

	@Override
	public List<Category> findAllCategories() {

		return categoryMapper.findAllCategories();
	}

	@Override
	public List<Category> findAllCategoryWithBooks() {

		return categoryMapper.findAllCategoryWithBooks();
	}

	@Override
	public Category findCategoryWithBooksById(BigInteger id) {
		return categoryMapper.findCategoryWithBooksById(id);
	}

	@Override
	public Category findCategoryWithCategoryById(BigInteger id) {
		return categoryMapper.findCategoryWithCategoryById(id);
	}

	@Override
	public void test() {
//		List<Category> categoryWithBooks = 
//		categoryMapper.findAllCategoryWithBooks();
		if (categoryMapper == null) {
			System.out.println(false);
			return;
		}
		List<Category> findAllCategories = categoryMapper.findAllCategoryWithBooks();
//		List<Category> selectCategories = categoryMapper.selectCategories();
		System.out.println(findAllCategories);
//		System.out.println(selectCategories);
	}

}
